package com.mingserve.raw.domain;

import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.mingserve.common.core.utils.StringUtils;
import com.mingserve.common.mybatis.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.HashMap;
import java.util.Map;

/**
 * 测点表
 *
 * @author lvwshuai
 * @date 2024-02-02
 */
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("phm_point")
public class Point extends BaseEntity
{
    /**
     * 测点编码
     */
    @TableId(value = "point_code")
    private String pointCode;
    /**
     * IoT编码
     */
    private String deviceCode;
    /**
     * 设备编码
     */
    private String equipmentCode;
    private String pointName;
    private String axial;
    /**
     * 安装时间
     */
    private Long installTime;

    public String getAxial() {
        if (StringUtils.isEmpty(axial)) {
            Map<String, String> map = new HashMap<>(3);
            map.put("x", "H");
            map.put("y", "A");
            map.put("z", "V");
            return JSON.toJSONString(map);
        }
        return axial;
    }
}